Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @batch reduction for bounds check #126

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

bennibolm
Copy link
Owner

@bennibolm bennibolm commented Mar 21, 2024

Polyester.jl supports an automatic reduction functionality with @batch since the newest version v0.7.10.
The bounds check of subcell limiting requires a reduction step of deviations, which created a lot of issue due to False Sharing in the past. After some testing and discussion, I implemented in PR #1736 a relatively ugly fix.
With the new Polyester functionality, we can achieve a much nicer solution with approximately the same performance and scaleability.

Test within branch bennibolm/subcell-limiting and fix in bennibolm/subcell-limiting-@batch-reduction

trixi_include("../examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl",
                       initial_refinement_level = 5)

results in

Roci:       old version                 new version wit @batch reduction
            time     %tot     avg       time     %tot     avg
1 Thread:   715ms    6.9%   457μs       707ms    6.8%   452μs
2 Threads:  348ms    4.7%   223μs       341ms    4.7%   218μs
4 Threads:  177ms    3.8%   113μs       173ms    3.9%   111μs
6 Threads:  121ms    3.3%  77.1μs       121ms    3.4%  77.4μs
8 Threads:  94.3ms   3.0%  60.3μs       93.0ms   2.9%  59.5μs
10 Threads: 77.4ms   2.6%  49.5μs       76.4ms   2.6%  48.9μs
12 Threads: 68.0ms   2.5%  43.5μs       66.7ms   2.4%  42.7μs
16 Threads: 55.1ms   2.2%  35.3μs       51.9ms   2.1%  33.2μs
24 Threads: 42.8ms   1.9%  27.4μs       38.3ms   1.7%  24.5μs

Copy link

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • The PR has a single goal that is clear from the PR title and/or description.
  • All code changes represent a single set of modifications that logically belong together.
  • No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • The code can be understood easily.
  • Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • There are no redundancies that can be removed by simple modularization/refactoring.
  • There are no leftover debug statements or commented code sections.
  • The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • New functions and types are documented with a docstring or top-level comment.
  • Relevant publications are referenced in docstrings (see example for formatting).
  • Inline comments are used to document longer or unusual code sections.
  • Comments describe intent ("why?") and not just functionality ("what?").
  • If the PR introduces a significant change or new feature, it is documented in NEWS.md.

Testing

  • The PR passes all tests.
  • New or modified lines of code are covered by tests.
  • New or modified tests run in less then 10 seconds.

Performance

  • There are no type instabilities or memory allocations in performance-critical parts.
  • If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • The correctness of the code was verified using appropriate tests.
  • If new equations/methods are added, a convergence test has been run and the results
    are posted in the PR.

Created with ❤️ by the Trixi.jl community.

@bennibolm bennibolm marked this pull request as ready for review March 27, 2024 18:00
@bennibolm bennibolm merged commit 2507794 into subcell-limiting Mar 27, 2024
7 of 34 checks passed
@bennibolm bennibolm deleted the subcell-limiting-@batch-reduction branch March 27, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant